package vip.yyzhu.redisadmin.aop.error;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class ErrorAop {
    /**
     * 此处使用环绕增强，在方法执行之前或者执行之后均会执行。
     */

    @Pointcut("execution(* vip.yyzhu.redisadmin.api..*(..))")
    public void doErrorAop() {
    }

    @AfterThrowing(value = "doErrorAop()", throwing = "ex")
    public void deBefore(JoinPoint pjp, Exception ex) {
        System.out.println("++++++*****++++ 发生方法异常!!!  ++++++*****++++");
        System.out.println("签名->"+pjp.getSignature());
        System.out.println(ex);
        ex.printStackTrace();
    }
}
